package cn.lysj.framework.elm.controller;

import cn.lysj.framework.base.BaseController;
import cn.lysj.framework.common.annotation.CurrentUser;
import cn.lysj.framework.common.domain.User;
import cn.lysj.framework.common.utils.pagination.PageVo;
import cn.lysj.framework.common.utils.web.Resp;
import cn.lysj.framework.elm.domain.ElmConfig;
import cn.lysj.framework.elm.service.ElmConfigService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

/**
 * @author drj
 * @description 饿了么配置控制层
 * @create 2019-01-21 12:34:24
 **/
@Slf4j
@RestController
@Api(description = "饿了么配置管理接口")
@RequestMapping("/elm_config")
public class ElmConfigController extends BaseController<ElmConfig>{

    @Resource
    private ElmConfigService elmConfigService;

    @Override
    public ElmConfigService getService() {
        return elmConfigService;
    }


    @GetMapping("/list_rewrite")
    public Resp list(@CurrentUser User user, ElmConfig config, PageVo pageVo) {
        config.setStoreId(user.getStoreId());
        return new Resp(elmConfigService.list(config, pageVo));
    }
}
